UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S2L7bzMd41oRzbSkx6T7r5DihF6Rs1nan36lbPSTOk0='
WHERE
key_id = '8d8209d9e13c67b64be7747d45e98df010f1d7caad3105be3ab74fed41385ab2'
AND (
token = 'S2L7bzMd41oRzbSkx6T7r5DihF6Rs1nan36lbPSTOk0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)