UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FhySQU3YlSlP/nCCcYmhbU/HUA+auoMINe9WV4P2u6Y=' 
WHERE 
  key_id = '161cde85aaa844da4eace2927c65695542fd3fa685e2ca0ee6658bb0b8789496' 
  AND (
    token = 'FhySQU3YlSlP/nCCcYmhbU/HUA+auoMINe9WV4P2u6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052