UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JnU0dCdmLBIA5qORCr60dFzrsyyT44+y+mMtw4PUfvc='
WHERE
key_id = '1394be1b89c24714f7d321d2f48447e20ac984f38d60d8955ff8058af550a14c'
AND (
token = 'JnU0dCdmLBIA5qORCr60dFzrsyyT44+y+mMtw4PUfvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)