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