UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l0mbk8ckIxbEsowEwOWvOOFAZKQRgFHsCZzcCmzWYWk=' 
WHERE 
  key_id = '1047b7202d82130dcef3df782a06e7de0aa50a3280e5ba4db11123597fa716d3' 
  AND (
    token = 'l0mbk8ckIxbEsowEwOWvOOFAZKQRgFHsCZzcCmzWYWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044