UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0c441Qvl3kqj2EjVECCxC7KUc0z8A1NASmyoj1jfqeg='
WHERE
key_id = 'b77a5e1fcf89a43e616cd3637b95b0d94f6969d82137efe3a40e6fa22220c239'
AND (
token = '0c441Qvl3kqj2EjVECCxC7KUc0z8A1NASmyoj1jfqeg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)