UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6KimedBLj34h5ZfzWZGCqDBOOowc8hI9jxyydEq/0tE=' 
WHERE 
  key_id = '4d77a0dfd845eef9eced7af5833a135920c9e628304eeb8c5bee16a57e4468c6' 
  AND (
    token = '6KimedBLj34h5ZfzWZGCqDBOOowc8hI9jxyydEq/0tE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031