UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ncx5rUUT+INBeJliS7I7GMBeZjoQIFb9V6SSf8d/f94=' 
WHERE 
  key_id = 'c59528c6cf0c52dcab95da5a84ad97b6a8172eb302bb81b8c883866d8e78e8a1' 
  AND (
    token = 'Ncx5rUUT+INBeJliS7I7GMBeZjoQIFb9V6SSf8d/f94=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048