UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGRWFvFKIMR3AnZDVGRcAlrYjgLIEnebuui39Q+s4lk=' 
WHERE 
  key_id = '32eeafa22bda71c86acd6be22a5f787173ca449b4a440cb8e4490ff525317736' 
  AND (
    token = 'pGRWFvFKIMR3AnZDVGRcAlrYjgLIEnebuui39Q+s4lk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022