UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XQLlinO7JPPZMDMpPHPyq6m0MPbhJ2rNAGAKy6RXi5M=' 
WHERE 
  key_id = '025f8b908fd56b6605117dd7601d613f721a9c2f70681dd4f3551d0361f59645' 
  AND (
    token = 'XQLlinO7JPPZMDMpPHPyq6m0MPbhJ2rNAGAKy6RXi5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056