UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HreLX6e94fvIlXfDYuZju/QjGxsg2iJ51vuUfDVCNwU=' 
WHERE 
  key_id = 'c1379905b8af1fda456933a8541eb412a592851370b3491fad31ed62fe9cbeec' 
  AND (
    token = 'HreLX6e94fvIlXfDYuZju/QjGxsg2iJ51vuUfDVCNwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036