UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DhpWW9YTjkap9zqYbvfhSSFp/bpeWB9Y6vHK4G4pfv8='
WHERE
key_id = '04ca6b303623c89a60c8238d39635b832b5a101ef6b9e3c5c6f404e1f1787c2e'
AND (
token = 'DhpWW9YTjkap9zqYbvfhSSFp/bpeWB9Y6vHK4G4pfv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)