UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bpTJGEQY0x2+C0nRpeyRpJZ3CEDiM4aoW3SF3koiRYc=' 
WHERE 
  key_id = '26d53a112e3816d5fa549ac1eb1392ad27809bb3020aada61073c73507a65833' 
  AND (
    token = 'bpTJGEQY0x2+C0nRpeyRpJZ3CEDiM4aoW3SF3koiRYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050