UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QyD8MKzM+0RG6B1kpCznCnuSHMUQrweGcoIdOmAXKbA='
WHERE
key_id = 'dc7b623b6ef566bffcec59c61b5eb2fce178ea49d41326000df56364c2f25724'
AND (
token = 'QyD8MKzM+0RG6B1kpCznCnuSHMUQrweGcoIdOmAXKbA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)