UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TR4FWwPfQsRo+mfpQ4w+T4RofVrrxiCoVV8TW9jjFlE=' 
WHERE 
  key_id = '5446add8778bd44d257952c6200a07965db1dd6cfd5beb0bf960c40a567e92f0' 
  AND (
    token = 'TR4FWwPfQsRo+mfpQ4w+T4RofVrrxiCoVV8TW9jjFlE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016