UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DPQAegf1vOK2WPxcETxzkhz3lPeK7S5H7rXchfi6hEo=' 
WHERE 
  key_id = 'ec71abbea2c13466335e49e974cce46eca245fdd311aea6febacb5b4a2594f24' 
  AND (
    token = 'DPQAegf1vOK2WPxcETxzkhz3lPeK7S5H7rXchfi6hEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022