UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jA1cn/PJF0x+TuOQe3e4b+7rnFrRxK/+YuCvFemJZRE='
WHERE
key_id = 'c342e660ccdcb961b4de830cc22fef685671968e32dad32e79415f6b03fcb6f6'
AND (
token = 'jA1cn/PJF0x+TuOQe3e4b+7rnFrRxK/+YuCvFemJZRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)