UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YixDtRd+xOhqEl0DPCKCcVajlwwJ+aGIykIkQcfi604='
WHERE
key_id = 'f97f0c565ce5217dea1fce31c62913794bc605b2b110f69feeeca880fb5bc882'
AND (
token = 'YixDtRd+xOhqEl0DPCKCcVajlwwJ+aGIykIkQcfi604='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)