UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6iHYculi8twjk1R/KVZDYb3wAKKqu0vjwHfl7WulYwA='
WHERE
key_id = '2ba2c4e837e77a7d40f0b69f451087efc582b19769eb853ed8b17a866b881a43'
AND (
token = '6iHYculi8twjk1R/KVZDYb3wAKKqu0vjwHfl7WulYwA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)