UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dMdaAlJvdqud80MzhizeckRJzGt2ijnHxe7acoxCRIA='
WHERE
key_id = 'faa8d347a0369f8f97f8059f4845a92a000112f59910a2677481bb986ecd7c66'
AND (
token = 'dMdaAlJvdqud80MzhizeckRJzGt2ijnHxe7acoxCRIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)