UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J7LQlj/h73bopr2dXu4g6OdkH90ad8j/l4gQ/pC1uDE=' 
WHERE 
  key_id = 'bf647a824dd7e28096ca52a0b76b6fcec5a5c45d02705a142d72d82bef8c0523' 
  AND (
    token = 'J7LQlj/h73bopr2dXu4g6OdkH90ad8j/l4gQ/pC1uDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043