UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HMPahd+SJ6feoamaIjwhA9yc+/+QIQek7Xd56/hShmU=' 
WHERE 
  key_id = '263e3bf32ea82664c705562766f941e8742a794e7dc037ac433aa3b9069ca476' 
  AND (
    token = 'HMPahd+SJ6feoamaIjwhA9yc+/+QIQek7Xd56/hShmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032