UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cky+13JFoZdAKE0FB9MKr7ZoIROjzbtVwU51lHRGc/A='
WHERE
key_id = '3f047f9635bc912bdc0d199240377b68cce9d8954bdb95386d831e2398618c14'
AND (
token = 'cky+13JFoZdAKE0FB9MKr7ZoIROjzbtVwU51lHRGc/A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)