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