UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4qhe+hIPJuk6fc9jFvFiWlMp6fJ6e7FfgqKT58gwdHw=' 
WHERE 
  key_id = '20b964a7e0bbc53a58a41220c3848158578b3d8a2d9634c8f60e918dc1214249' 
  AND (
    token = '4qhe+hIPJuk6fc9jFvFiWlMp6fJ6e7FfgqKT58gwdHw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032