UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AmYjKqbuoWkbLS5s5TvI8H8EsmWQL2NN9rEqeCXR40g=' 
WHERE 
  key_id = '99bbcf818a8da90a2006210ddd538eb039cf3020c75b75116860ec0150b4162f' 
  AND (
    token = 'AmYjKqbuoWkbLS5s5TvI8H8EsmWQL2NN9rEqeCXR40g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028