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