UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B89Ey1phNE8CeRuR5K1VyrCupGCYWhBGacCe+6nAEDw=' 
WHERE 
  key_id = '88912eeb25c64c77594d9df9fab00a005712a03dd5b0ec2901d8d247b839951d' 
  AND (
    token = 'B89Ey1phNE8CeRuR5K1VyrCupGCYWhBGacCe+6nAEDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034