UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wBK+xW2724sBiauhQjPhuQMn5UrdDRDnF6pE0tFbgq8=' 
WHERE 
  key_id = '108915a43f818fea2a33cb1feb5d24da4c2fda35315cd314888a2119667925f5' 
  AND (
    token = 'wBK+xW2724sBiauhQjPhuQMn5UrdDRDnF6pE0tFbgq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020