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