UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8DBxf9U5HXUv3LUQHdiPo3DYzhlrVqjG/n5g5MkHj5o='
WHERE
key_id = 'e27b77d7ca63ff2b70ea9d31729e8dc60809a506159dcfa5d700cdb39c0748c4'
AND (
token = '8DBxf9U5HXUv3LUQHdiPo3DYzhlrVqjG/n5g5MkHj5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)