UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+ydDgY2SZmRs7vb+HIGT3dCII1NzZTGf6tXzviFp6Tg='
WHERE
key_id = 'a395c35b7cd20e2f6bf93c484c901aea183d7a6549053a14dc89095c7b5c12ab'
AND (
token = '+ydDgY2SZmRs7vb+HIGT3dCII1NzZTGf6tXzviFp6Tg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)