UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rc54MPDAuBPNNkTA+2OPgrGGO98UkbMGe3naXdANBzQ=' 
WHERE 
  key_id = '7974d2fdf7a92f7eefb614271ef63f0935ada109042902c27a422b104aede2ba' 
  AND (
    token = 'rc54MPDAuBPNNkTA+2OPgrGGO98UkbMGe3naXdANBzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030