UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V+gSYO5FltPXxHkyX384uz+z6UiIfG7qQFEQkA72iek=' 
WHERE 
  key_id = '1d71a326796274dde2e0fe31449e1cd497b7616c8052a3c7aa836e8a8ee2ce7c' 
  AND (
    token = 'V+gSYO5FltPXxHkyX384uz+z6UiIfG7qQFEQkA72iek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059