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