UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aE9htJczrTc7LV8/tSTl8T60dGQMEUYdKT/l0DlADes=' 
WHERE 
  key_id = '5c04f4f09b2c2ee233689a9d74bc2a6b530d4be5986f1ac1d81778ef8b56ba46' 
  AND (
    token = 'aE9htJczrTc7LV8/tSTl8T60dGQMEUYdKT/l0DlADes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028