UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VXh+FwWD9DmmR0nVlKxRgekogI4v+uqhSn3/AJlDLOk=' 
WHERE 
  key_id = '31f91da7e6afe3b16280133bcd32101b0439d8991b664031cc92311cde7e0664' 
  AND (
    token = 'VXh+FwWD9DmmR0nVlKxRgekogI4v+uqhSn3/AJlDLOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045