UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gZhrWj6cqi+15ny7PgSGJtlXNa6GWwNVHA+THNfmGZI='
WHERE
key_id = 'a21c0f975527168fdd6db93a345481ec0640babf3eaf2248e4588649ecadc367'
AND (
token = 'gZhrWj6cqi+15ny7PgSGJtlXNa6GWwNVHA+THNfmGZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)