UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4CiNTkt9ZkgHrLpODPxGcxdus6KNFQtarOTwcUoXdFo='
WHERE
key_id = '9ee82936cce8bf741712b347d468363483a16c509ccc0e8bf187b4368e73860d'
AND (
token = '4CiNTkt9ZkgHrLpODPxGcxdus6KNFQtarOTwcUoXdFo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)