UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jANN/QuI4tvDVzg642XsaRgay7inEYSkiXkS+t/RHB0='
WHERE
key_id = 'c9418c74163d7e8312a7efdf08dedb7bdebf6e1ebde0a7d3d8184a436b487dc0'
AND (
token = 'jANN/QuI4tvDVzg642XsaRgay7inEYSkiXkS+t/RHB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)