UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nzHL98VKaZagcC5KAzJcHkwI+T+EqhWr1WUfhnVCwes=' 
WHERE 
  key_id = '38a8b626aeafc122ba0f2686d474313aea71ce3ed633e9d6b17a6cc3546febf2' 
  AND (
    token = 'nzHL98VKaZagcC5KAzJcHkwI+T+EqhWr1WUfhnVCwes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027