UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FtiueUSD8c2gfcm9bGKc5xx9Bsi9X7Vx7aQLhk23wF8=' 
WHERE 
  key_id = '932af75807cdeb43824357d9414b3a3196837a073856726a49e21ecd62a79867' 
  AND (
    token = 'FtiueUSD8c2gfcm9bGKc5xx9Bsi9X7Vx7aQLhk23wF8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033