UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6LGDYb8Cx5Gvrz63ijavsnOUBKfE5Nm8SCcHOTwaHAs='
WHERE
key_id = 'aad9d32a5a26be7d556bfef4bc05fa0ffbfbfec74c4df309b2795af3ec2ffa87'
AND (
token = '6LGDYb8Cx5Gvrz63ijavsnOUBKfE5Nm8SCcHOTwaHAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)