UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HU+QPCTmmyXOn4kNembLz/cuuegS7ZigqqS3j4W+5os=' 
WHERE 
  key_id = '854ec151b4d0823f0598fbe5587e94fd05276f6f8ba15d9e1f5ea856b96be07b' 
  AND (
    token = 'HU+QPCTmmyXOn4kNembLz/cuuegS7ZigqqS3j4W+5os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034