UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QZC9vY21/IICXnSnVvXFGqrWfWChMhsRaXgG2kV+lVo=' 
WHERE 
  key_id = '509f56f493128f11c26769aa1c8bde54a2b6d557cdbc960a5c44a3869b3bbe59' 
  AND (
    token = 'QZC9vY21/IICXnSnVvXFGqrWfWChMhsRaXgG2kV+lVo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031