UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x+RsEkm9zSkARk4paLvMhsCGTB8IG9BRZJKa5kXIQ7k=' 
WHERE 
  key_id = 'ae82da5c1f9f0fb4a252f521808c106a7aa33e15530820048f29ecb44e280d27' 
  AND (
    token = 'x+RsEkm9zSkARk4paLvMhsCGTB8IG9BRZJKa5kXIQ7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034