UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qD/9yn/CXz7UJ7wuE2mWIICI14rpSmNQ4IU460f01YI='
WHERE
key_id = 'de08753c8b9bd14d00544df3c854d91e312de6db0100d42e1d2152f8a2e53b8a'
AND (
token = 'qD/9yn/CXz7UJ7wuE2mWIICI14rpSmNQ4IU460f01YI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)