UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QmlO1HjyaNTSm3dARcaNkQ4ixa+zgRyx0iigdA3et3o='
WHERE
key_id = '3001821de69c849db7d141d92a522e913d5fb54fbadbdc9d71802bd69fed82e6'
AND (
token = 'QmlO1HjyaNTSm3dARcaNkQ4ixa+zgRyx0iigdA3et3o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)