UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EuVZwlrY4wWCMocQncOZSMm4uGVcdnrTrredqGq1oF4='
WHERE
key_id = 'd0780871a2effadce908192a1dfe2cc6c0d594e75e16261551c92fa4ac7f4076'
AND (
token = 'EuVZwlrY4wWCMocQncOZSMm4uGVcdnrTrredqGq1oF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)