UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8YOpMHj6mbQCqhlDundweBAvnVfdZZIRNLUqVNpSaKA='
WHERE
key_id = 'f38d229de0501e1f1a0dd392c873b255b390b49de73254c61f8dd6f305ed3daf'
AND (
token = '8YOpMHj6mbQCqhlDundweBAvnVfdZZIRNLUqVNpSaKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)