UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's5n2WQC0eCPpdHEiRasp9CCsw/Kx2b9wGm4aB4gOT+0=' 
WHERE 
  key_id = 'b4d4578cabcc6f7801eaf59a66a9e542c7fbbdf6e9ff7c86ca17400402220846' 
  AND (
    token = 's5n2WQC0eCPpdHEiRasp9CCsw/Kx2b9wGm4aB4gOT+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033