UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wn+DY/ft9UL2qLVsTBJlidBJIuIv7GcSL4rQxqstxM4='
WHERE
key_id = '3e37078dc28a9a812f727fd52b64ebf75ac9c9542986113e03c9c9e8b18e6662'
AND (
token = 'wn+DY/ft9UL2qLVsTBJlidBJIuIv7GcSL4rQxqstxM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)