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