UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oq1Z4MkEpSDFERf+kEanpk8Ctk4Q7nWPUm+qQ7neAQM=' 
WHERE 
  key_id = '1a978fcca644580c1fa8788ca0b8290d1e5d13588940ab9e3ede2482c1e6e284' 
  AND (
    token = 'oq1Z4MkEpSDFERf+kEanpk8Ctk4Q7nWPUm+qQ7neAQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024