UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hp+59m1TvXj4RWwWvvBjTdis1sSp+BRO+mDIPcvLc2g='
WHERE
key_id = '8e8de7223fdea06e5ad77d451c01e4e8f30a33152b3dbab12675bec3fd259a5c'
AND (
token = 'hp+59m1TvXj4RWwWvvBjTdis1sSp+BRO+mDIPcvLc2g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)