UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wiEkA3G0DsIUV7KIBnSMY27MzE+PqYpgB3byTF4Xdxo='
WHERE
key_id = '870702a786cb53a2d8c632d29cc26e9a95e0706c2b81420fb2d79a4d97f54446'
AND (
token = 'wiEkA3G0DsIUV7KIBnSMY27MzE+PqYpgB3byTF4Xdxo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)