UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nDHbK8eX9DyzKjlxJDQj/TdML4PcsdlTF+YP7npeKJk='
WHERE
key_id = 'edfa9f398c3fea6e909a99c747ced14c58510b1bde4d592c5e8def22893e3869'
AND (
token = 'nDHbK8eX9DyzKjlxJDQj/TdML4PcsdlTF+YP7npeKJk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)