UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QiXyEw5oNpfscfm3M9SDXK4+300WA/qlAr0jnDFeJOk='
WHERE
key_id = '00a17f6be3b7013b702567cc3b323f3e16a51fc53269106a76af34eb8c0ac6e9'
AND (
token = 'QiXyEw5oNpfscfm3M9SDXK4+300WA/qlAr0jnDFeJOk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)