UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wpoGieZhN+Jh/kf5+yRUBH+GZEfnzrkw4WqU0npNqL8='
WHERE
key_id = 'aa992889966fb4283a0edf7b7de8ed1d8778f86148b41ff216efec8eccd003ee'
AND (
token = 'wpoGieZhN+Jh/kf5+yRUBH+GZEfnzrkw4WqU0npNqL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)